
import std.random;
import std.math;
import std.stdio:writefln;

class Neuron{

	float eval() {
		float ret = .0f;
		for(int i = 0; i < inputs.length; i++)
			ret += inputs[i] * weights[i];
		output = activationFunc(ret);
		return output;
	}

	this(int size){
		inputs = new float[size];
		weights = new float[size];
		for(int i = 0; i < size; ++i){
			weights[i] = ((rand() % 10000) / 1000.0) - 5.0;
			inputs[i] = 1.0;
		}
	}

	float[]		inputs = null;
	float[]		weights = null;
	float		delta = 0;
	float		output;
	float		errorFactor;
}

float activationFunc(float s){
	return 1.0 / (1.0 + exp(-s));
}
